import React, { Component } from 'react'
import Authorized, {reloadAuthorized, havePermission} from '@/utils/Authorized';
import { setSessionData, getData } from '@/utils/localData';
import { Alert } from 'antd';
import { Button } from 'antd';


export default class TestAuth3 extends Component {

    noMatch = <Alert message="No permission." type="error" showIcon />;

    // havePermission = (authorizedList) => {
    //     console.log("权限字符串===>",authorizedList)
    //     if(authorizedList.includes('AUTH_SMSROLE_ADD') 
    //         && authorizedList.includes('AUTH_SMSROLE_DEL')){
    //         return true
    //     }
    //     return false
    // };

    render() {
        return (
            <div>
                <div>权限测试3</div>
                <Authorized authority={havePermission("AUTH_SMSROLE_ADD")} noMatch={this.noMatch}>
                    <div>测试字符串</div>
                </Authorized>
                <div><Button type="primary" onClick={()=>{
                    setSessionData("myAuthorized",['user','admin'])
                }}>设置权限</Button></div>
                <Button onClick={()=>{
                    console.log(getData("myAuthorized"))
                }}></Button>
            </div>
        )
    }
}
